<template>
  <div class="">
    <n-dropdown trigger="hover" :options="options" @select="handleSelect">
      <n-button quaternary type="info"
        >更多<i class="iconfont dx-xiala"></i>
      </n-button>
    </n-dropdown>
    <n-modal v-model:show="showModal" preset="card" class="asdfsdfrert">
      <template #header>
        <div>
          <span v-if="isdrrt == 1">发放奖金</span>
          <span v-if="isdrrt == 2">扣平台币</span>
        </div>
      </template>
      <div>
        <n-form
          ref="formRef"
          label-placement="left"
          :label-width="80"
          :model="formValue"
          :rules="rules"
        >
          <n-form-item label="金币" path="jiner">
            <n-input
              v-model:value="formValue.jiner"
              placeholder="输入金币数量"
            />
          </n-form-item>
          <n-form-item label="备注" path="beizhu">
            <n-input
              v-model:value="formValue.beizhu"
              placeholder="输入备注"
              type="textarea"
            />
          </n-form-item>
        </n-form>
      </div>
      <template #action>
        <div class="tr">
          <n-button type="info" @click="dsfsdryty" :loading="dfdsytuyui"> 确认 </n-button>
          <n-button class="ml20" @click="showModal = false"> 取消 </n-button>
        </div>
      </template>
    </n-modal>





    <n-modal v-model:show="showModaler" preset="card" class="dsfdsertyerty">
    <!-- <template #header>
    <div>收支情况</div>
    </template> -->
    <div>
      <iframe class="w100 sdfdsftrtretr" :src="ifomsd"></iframe>
    </div>
    <template #action>
    <div class="tr">
    <n-button @click="showModaler=false"> 关闭 </n-button>
    </div>
    </template>
    </n-modal>
  </div>
</template>
<script lang="ts" setup>
import { ref } from "vue";
import { dialog, dxpost } from "../../../util/index";
let props = defineProps({
  dxdata: { type: Object },
});
const isdrrt = ref(1); // 1=加 2为减
const emit = defineEmits(["callback"]);
const showModal = ref(false);
const formRef = ref();
const dfdsytuyui =ref(false)
const showModaler =ref(false)
const ifomsd  =ref()
const formValue = ref({
  jiner: "",
  beizhu: "",
});
const handleValidateClick = () => {};
const rules = {
  jiner: {
    required: true,
    message: "请输入金币数量",
    trigger: "blur",
  },
  beizhu: {
    required: true,
    message: "请输入备注",
    trigger: "blur",
  },
};
const options = ref([
  {
    label: "查看地址",
    key: 1,
  },
  {
    label: "收支情况",
    key: 2,
  },
  {
    label: "发放奖金",
    key: 3,
  },
  {
    label: "扣平台币",
    key: 4,
  },
]);
const handleSelect = async (data) => {
  if (data == 1) {
    showModaler.value = true
    ifomsd.value = 'https://duxinggj-1251133427.cos.ap-guangzhou.myqcloud.com/case/jyc/index.html#/pages/sp/dizhiguanli?uid='+props.dxdata.id
    return;
  }
  if (data == 2) {
    showModaler.value = true
    ifomsd.value = 'https://duxinggj-1251133427.cos.ap-guangzhou.myqcloud.com/case/jyc/index.html#/pages/user/wodeqb?uid='+props.dxdata.id
    return;
  }
  formValue.value = { jiner: "", beizhu: "" };
  if (data == 3) {
    isdrrt.value = 1;
    showModal.value = true;
  }
  if (data == 4) {
    isdrrt.value = 2;
    showModal.value = true;
  }
  emit("callback", "666888122226");
};
const dsfsdryty = () => {
  formRef.value?.validate(async(errors) => {
    if (!errors) {
      dfdsytuyui.value = true
     await dxpost("jyc/jycadmin/ptjiansdd",{
        id:props.dxdata.id,
        leixing:isdrrt.value,
        jiner:formValue.value.jiner,
        beizhu:formValue.value.beizhu,
        czlx:isdrrt.value==1?'发放奖金':'扣平台币',
        type:1
      })
      dfdsytuyui.value = false
      showModal.value = false;
      emit("callback", "666888122226");
    }
  });
};
</script>
<style scoped>
 .sdfdsftrtretr{
    height: 650px;
    border: 0;
  }
</style>
